package com.eeepay.eeepay_v2.util;

import android.text.TextUtils;

import com.eeepay.eeepay_v2.model.QueryResult;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;

/**
 * Created by Administrator on 2016/5/13.
 * 排序工具类
 */
public class SortUtils {


    /**
     * @param
     * @param
     * @return
     * 按时间排序
     */
    public static boolean compareDate(List<QueryResult> datas) {
        boolean flag = false;

        SimpleDateFormat format = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss", Locale.CHINA);
        try {
            if (datas !=null && datas.size()>0) {//集合不为空
                QueryResult result = null;
                for (int i = 0;i<datas.size();i++){
                    result = datas.get(i);
                    Date d1 = format.parse(result.getTradeTime());
                    Date d2 = format.parse(result.getTradeTime());
                    if (d1.getTime() > d2.getTime()) {
                        flag = true;

                    }
                }
            }
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return flag;
    }
}
